{include file="public/head" /}
  <style>
  #click{
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    position:fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: none;

  }
</style>
  <body>
    <div id="click" onclick="aa()" ></div>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>小程序管理</cite></a>
        <a><cite>商品列表</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      
      <xblock>
         <button class="layui-btn " onclick="x_admin_show('添加','{:url('add')}',550,600)"><i class="layui-icon"></i>添加</button>
        <span class="x-right" style="line-height:40px">共有数据：条</span>
      </xblock>
      <table class="layui-table" id="table">
        <thead  style="text-align:center;">
          <tr>
            <th style="text-align: center; font-size: 16px;width:15%">名称</th>
            
            <th style="text-align: center; font-size: 16px;width:7%">在售价</th>
            <th style="text-align: center; font-size: 16px;width:7%">劵后价</th>
            <th style="text-align: center; font-size: 16px;width:8%">抵扣物业费</th>
           
            <th style="text-align: center; font-size: 16px;width:10%">图片</th>
            <th style="text-align: center; font-size: 16px;">链接</th>
            <th style="text-align: center; font-size: 16px;width:10%">操作</th>
          </tr>
        </thead>
        <tbody style="text-align:center;">
          {foreach $data as $val}
          <tr>
            <td style="text-align: center;">{$val.goods_name}</td> 
            <td style="text-align: center;">{$val.salesprice}</td> 
            <td style="text-align: center;">{$val.price}</td> 
            <td style="text-align: center;">{$val.property_price}</td> 
            <td style="text-align: center;">
              <img src="{$val.icon}"  onclick='mag("{$val.icon}")' style="width:40px;height:40px">
            </td>   
            <td style="text-align: center;">{$val.url}</td> 
            <td style="text-align: center;">
              <a title="编辑"  onclick="x_admin_show('编辑','{:url('edit')}?id={$val.id}',700,500)" href="javascript:;">
                <i class="layui-icon">&#xe642;</i>
              </a>
              <a title="删除" onclick="del('{$val.id}')" href="javascript:;" id="{$val.id}">
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div id="page">
            
        </div>
      </div>

    </div>
   <script>
        let a = document.getElementById("click")
        function mag(url){
            // console.log(123)

            a.style = "display:inline-block;"
            let b = `<img src="`+url+`" style="margin-left: 20vw;">`
            a.innerHTML=b
        }
        function aa() {
            a.style = "display:none;"
        }
        function del(id){
          if(confirm('删除后无法恢复，确定要删除吗?')) 
          { 
            var url = "{:url('del')}?id=" + id
            // console.log(url)
            $('#' + id).attr('href', url)
          } 
            return false; 
        } 
      
    </script>

    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>

  </body>

</html>